//
//  Order_Type_TableViewCell.swift
//  Pods
//
//  Created by eme on 2017/4/1.
//
//
/*
 owner:gyh
 update:2016年12月19日17:58:45
 info: 订单-订单详情Cell(订单详情Cell)
 */
import UIKit
import RickonCore

class Order_Type_TableViewCell: UITableViewCell {
    
    @IBOutlet weak var statusIcon: UIImageView!
    @IBOutlet weak var statusLabel: UILabel!
    @IBOutlet weak var right_Icon: UIImageView!
    @IBOutlet weak var left_line: NSLayoutConstraint!       //0区,分割线距离左边
    @IBOutlet weak var right_Line: NSLayoutConstraint!      //0区,分割线距离右边

    @IBOutlet weak var lineView: UIView!
    var status:String = ""
    
    var item:KuaidiModel?{
        didSet{
            if let Model = item{
                
                let resultModel = Model.result
                
                if self.status == "0"{
                    
                    self.statusIcon?.image = UIImage(named: "DFK_Icon_details", in: SansaCore.bundle, compatibleWith: nil)
                    self.right_Icon.isHidden = true
                    self.statusLabel.text = "待付款"
                }else{
                    
                    if resultModel.deliverystatus == "1"
                    {
                        self.statusIcon.image = UIImage(named: "WSH_Image", in: SansaCore.bundle, compatibleWith: nil)
                    }
                    else if resultModel.deliverystatus == "2"
                    {
                        self.statusIcon.image = UIImage(named: "WSH_Image", in: SansaCore.bundle, compatibleWith: nil)
                    }
                    else if resultModel.deliverystatus == "3"
                    {
                        self.statusIcon.image = UIImage(named: "SYH_image", in: SansaCore.bundle, compatibleWith: nil)
                    }
                    else
                    {
                        self.statusIcon.image = UIImage(named: "JH_Image", in: SansaCore.bundle, compatibleWith: nil)
                    }
                    if Model.status == "0"{
                        if resultModel.list.count > 0{
                            self.statusLabel.text = resultModel.list[0].status
                        }
                        
                    }else{
                        
                        self.statusLabel.text = Model.msg
                    }
                    
                    self.right_Icon.isHidden = false
                    self.left_line.constant = 0
                    self.right_Line.constant = 0
                    
                }
            }
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        lineView.backgroundColor = Theme.v.separate_Line
        statusLabel.normal_fontSize(14)
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
